<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>基金管理</title>
    <script src="js/jquery.min.js">
    </script>

    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js">
    </script>

    <script>
        $(document).ready(function () {

            var link = window.location.href;

            $("button").click(function () {
                alert("点了")

                wx.ready(function () {
                    wx.agentConfig({
                        corpid: 'wwf861751e07fa2ed0', // 必填，企业微信的corpid，必须与当前登录的企业一致
                        agentid: '1000007', // 必填，企业微信的应用id
                        timestamp: '1634204547', // 必填，生成签名的时间戳
                        nonceStr: 'AAA', // 必填，生成签名的随机串
                        signature: '046023d46e3a600429a187f6fef72286cee48b41', // 必填，签名，见附录1
                        jsApiList: ['agentConfig',
                            'openUserProfile',
                            'thirdPartyOpenPage',
                            'shareToExternalContact'
                        ], //必填
                        success: function (res) {
                            alert("成功回调")
                            // 发起审批流程
                            wx.invoke(
                                "shareToExternalContact", {
                                    text: {
                                        content: "", // 文本内容
                                    },
                                    attachments: [
                                    ]
                                },
                                function (res) {
                                    if (res.err_msg ==
                                        "shareToExternalContact:ok"
                                    ) {}
                                });

                        },
                        fail: function (res) {
                            alert("失败")
                            if (res.errMsg.indexOf(
                                    'function not exist') > -
                                1) {
                                alert('版本过低请升级')
                            }
                        }
                    });
                })

            });
        });
    </script>
</head>

<body>
    <button>点我</button>
</body>

</html>